<!DOCTYPE html>
<html lang="zh">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta http-equiv="X-UA-Compatible" content="ie=edge">
		<title>机构端</title>
        <script src="/Public/static/jquery-2.0.3.min.js"></script>
        <script src="/Public/static/layer/layer.js"></script>
        <link rel="stylesheet" href="__PUBLIC__/Home/css/reset.css">
        <link rel="stylesheet" href="__PUBLIC__/Home/css/style.css">
        <link rel="stylesheet" href="__PUBLIC__/Home/css/page.css" />
	</head>

	<body class="agency_box contentBox pos_rel dpflxr">
		<include file="head" />

		<!-- 2.垂直导航 -->
		<div class="navColumn">
			<a href="{:U('Mechanism/index')}" <if condition="$cur eq '信息设置'">class="navColumnItem actived dpflxr pos_rel"<else/>class="navColumnItem dpflxr pos_rel"</if> data-type='1'>
				<div class="lineColumn pos_abs"></div>
				<label for="">信息设置</label>
				<div class="rightArrow">
				</div>
			</a>
			<a href="{:U('Mechanism/department_manage')}" <if condition="$cur eq '部门管理'">class="navColumnItem actived dpflxr pos_rel"<else/>class="navColumnItem dpflxr pos_rel"</if> data-type='2'>
				<div class="lineColumn pos_abs"></div>
				<label for="">部门管理</label>
				<div class="rightArrow">
				</div>
			</a>
			<a href="{:U('Mechanism/staff')}" <if condition="$cur eq '员工管理'">class="navColumnItem actived dpflxr pos_rel"<else/>class="navColumnItem dpflxr pos_rel"</if> data-type='3'>
				<div class="lineColumn pos_abs"></div>
				<label for="">员工管理</label>
				<div class="rightArrow">
				</div>
			</a>
			<a href="{:U('Mechanism/role_manage')}" <if condition="$cur eq '权限管理'">class="navColumnItem actived dpflxr pos_rel"<else/>class="navColumnItem dpflxr pos_rel"</if> data-type='4'>
				<div class="lineColumn pos_abs"></div>
				<label for="">权限管理</label>
				<div class="rightArrow">
				</div>
			</a>
			<a href="{:U('Mechanism/punch_record')}" <if condition="$cur eq '打卡记录'">class="navColumnItem actived dpflxr pos_rel"<else/>class="navColumnItem dpflxr pos_rel"</if> data-type='5'>
				<div class="lineColumn pos_abs"></div>
				<label for="">打卡记录</label>
				<div class="rightArrow">
				</div>
			</a>
		</div>


		<!-- 3.垂直导航分类页面 -->
	
		<!-- 3.4 权限管理  -->
		<div class="contentArea tabPage actived">
			
			<!-- 3.4.1 新增角色 -->
			<div class="authorityAdd">
				
				<div class="caTitleBox dpflxr">
					<label for="" class="caTitle">新增角色</label>	
				</div>
				<div class="card switchPage">
					
					<div class="dpflxr">
						<div class="contentItem  dpflxr">
							<label for="" class="title">角色名称：</label>
							<input type="text" class="inputBox" name="role_name" value="{$info['role_name']}" placeholder="请输入角色名称"
								placeholder-style="font-size:16px;line-height:48px;color:#bfa;" />
						</div>
						<div class="contentItem  dpflxr">
							<label for="" class="title">角色介绍：</label>
							<input type="text" class="inputBox" name="func" value="{$info['func']}" placeholder="请输入简介"
								placeholder-style="font-size:16px;line-height:48px;color:#bfa;" />
						</div>
						<div class="contentItem  dpflxr">
							<label for="" class="title">状态：</label>
							
							<select name="" id="sex" class="selectBox">
								<option value="1" <if condition="$info['status'] eq 1">selected</if>>正常</option>
								<option value="2" <if condition="$info['status'] eq 2">selected</if>>已禁用</option>
							</select>
						</div>
					
					<div class="contentItem checkBox dpflxr">
							<label for="" class="title">权限设置：</label>
							<div class="checkBoxArea  dpflxr">
								<div class="dpflxc three">
									<div class="checkBoxItem dpflxr t1">
										<input type="checkbox" <if condition="$a eq 1 && $b eq 2 && $c eq 3 && $d eq 4 && $e eq 5">checked</if>>
										<label>机构管理</label>
									</div>
									<div class="checkBoxItem white dpflxr">
										<input type="checkbox" name="jurisdiction[]" value="1" <if condition="$a eq 1">checked</if>>
										<label>信息设置</label>
									</div>
									<div class="checkBoxItem white dpflxr" >
										<input type="checkbox" name="jurisdiction[]" value="2" <if condition="$b eq 2">checked</if>>
										<label>部门管理</label>
									</div>
									<div class="checkBoxItem white dpflxr" >
										<input type="checkbox" name="jurisdiction[]" value="3" <if condition="$c eq 3">checked</if>>
										<label>员工管理</label>
									</div>
									<div class="checkBoxItem white dpflxr" >
										<input type="checkbox" name="jurisdiction[]" value="4" <if condition="$d eq 4">checked</if>>
										<label>权限管理</label>
									</div>
									<div class="checkBoxItem white dpflxr" >
										<input type="checkbox" name="jurisdiction[]" value="5" <if condition="$e eq 5">checked</if>>
										<label>打卡记录</label>
									</div>
								</div>
								
								<div class="dpflxc three">
									<div class="checkBoxItem dpflxr t2">
										<input type="checkbox" <if condition="$f eq 6 && $g eq 7 && $h eq 8 && $ia eq 9">checked</if>>
										<label>楼盘管理</label>
									</div>
									<div class="checkBoxItem white dpflxr" >
										<input type="checkbox" name="jurisdiction1[]" value="6" <if condition="$f eq 6">checked</if>>
										<label>楼盘管理</label>
									</div>
									<div class="checkBoxItem white dpflxr">
										<input type="checkbox" name="jurisdiction1[]" value="7" <if condition="$g eq 7">checked</if>>
										<label>户型管理</label>
									</div>
									<div class="checkBoxItem white dpflxr">
										<input type="checkbox" name="jurisdiction1[]" value="8" <if condition="$h eq 8">checked</if>>
										<label>楼栋管理</label>
									</div>
									<div class="checkBoxItem white dpflxr" >
										<input type="checkbox" name="jurisdiction1[]" value="9" <if condition="$ia eq 9">checked</if>>
										<label>房源管理</label>
									</div>
								</div>

								<div class="dpflxc three">
									<div class="checkBoxItem dpflxr t3">
										<input type="checkbox" <if condition="$j eq 10 && $k eq 11 && $l eq 12 && $m eq 13">checked</if>>
										<label>促销活动</label>
									</div>
									<div class="checkBoxItem white dpflxr">
										<input type="checkbox" name="jurisdiction2[]" value="10" <if condition="$j eq 10">checked</if>>
										<label>新闻管理</label>
									</div>
									<div class="checkBoxItem white dpflxr">
										<input type="checkbox" name="jurisdiction2[]" value="11" <if condition="$k eq 11">checked</if>>
										<label>新闻分类</label>
									</div>
									<div class="checkBoxItem white dpflxr">
										<input type="checkbox" name="jurisdiction2[]" value="12" <if condition="$l eq 12">checked</if>>
										<label>活动管理</label>
									</div>
									<div class="checkBoxItem white dpflxr">
										<input type="checkbox" name="jurisdiction2[]" value="13" <if condition="$m eq 13">checked</if>>
										<label>活动报名</label>
									</div>
								</div>
								

								<div class="dpflxc three">
									<div class="checkBoxItem dpflxr t4">
										<input type="checkbox" <if condition="$n eq 14 && $o eq 15 && $p eq 16">checked</if>>
										<label>商品管理</label>
									</div>
									<div class="checkBoxItem white dpflxr">
										<input type="checkbox" name="jurisdiction3[]" value="14" <if condition="$n eq 14">checked</if>>
										<label>商品管理</label>
									</div>
									<div class="checkBoxItem white dpflxr">
										<input type="checkbox" name="jurisdiction3[]" value="15" <if condition="$o eq 15">checked</if>>
										<label>分类管理</label>
									</div>
									<div class="checkBoxItem white dpflxr">
										<input type="checkbox" name="jurisdiction3[]" value="16" <if condition="$p eq 16">checked</if>>
										<label>兑换管理</label>
									</div>
								</div>


								<div class="dpflxc three">
									<div class="checkBoxItem dpflxr t5">
										<input type="checkbox" <if condition="$q eq 17 && $r eq 18 && $s eq 19 && $t eq 20 && $u eq 21 && $v eq 22">checked</if>>
										<label>数据管理</label>
									</div>
									<div class="checkBoxItem white dpflxr">
										<input type="checkbox" name="jurisdiction4[]" value="17" <if condition="$q eq 17">checked</if>>
										<label>客户统计</label>
									</div>
									<div class="checkBoxItem white dpflxr">
										<input type="checkbox" name="jurisdiction4[]" value="18" <if condition="$r eq 18">checked</if>>
										<label>统计数据</label>
									</div>
									<div class="checkBoxItem white dpflxr">
										<input type="checkbox" name="jurisdiction4[]" value="19" <if condition="$s eq 19">checked</if>>
										<label>业绩排名</label>
									</div>
									<div class="checkBoxItem white dpflxr">
										<input type="checkbox" name="jurisdiction4[]" value="20" <if condition="$t eq 20">checked</if>>
										<label>转化情况</label>
									</div>
									<div class="checkBoxItem white dpflxr" style="padding-right:0;">
										<input type="checkbox" name="jurisdiction4[]" value="21" <if condition="$u eq 21">checked</if>>
										<label>用户浏览统计</label>
									</div>
									<div class="checkBoxItem white dpflxr">
										<input type="checkbox" name="jurisdiction4[]" value="22" <if condition="$v eq 22">checked</if>>
										<label>房源统计</label>
									</div>
								</div>


								<div class="dpflxc three">
									<div class="checkBoxItem dpflxr t6">
										<input type="checkbox" <if condition="$w eq 23 && $x eq 24">checked</if>>
										<label>用户管理</label>
									</div>
									<div class="checkBoxItem white dpflxr">
										<input type="checkbox" name="jurisdiction5[]" value="23" <if condition="$w eq 23">checked</if>>
										<label>用户管理</label>
									</div>
									<div class="checkBoxItem white dpflxr">
										<input type="checkbox" name="jurisdiction5[]" value="24" <if condition="$x eq 24">checked</if>>
										<label>经纪人管理</label>
									</div>
								</div>


								<div class="dpflxc three">
									<div class="checkBoxItem dpflxr t7">
										<input type="checkbox" <if condition="$y eq 25 && $z eq 26">checked</if>>
										<label>系统配置</label>
									</div>
									<div class="checkBoxItem white dpflxr">
										<input type="checkbox" name="jurisdiction6[]" value="25" <if condition="$y eq 25">checked</if>>
										<label>系统配置</label>
									</div>
									<div class="checkBoxItem white dpflxr" style="padding-right:0;">
										<input type="checkbox" name="jurisdiction6[]" value="26" <if condition="$z eq 26">checked</if>>
										<label>客户信息配置</label>
									</div>
								</div>
							</div>
							
						
							
					</div>
					
					
					</div>
					<input type="hidden" name="id" value="{$info['id']}">
					
					<div class="ciBtn" id="qr"><label>保存</label></div>
				</div>
			</div>
			
					
			
		</div>
		
		
		
	

		
	</body>
</html>
<script type="text/javascript">
	$('.t1').click(function(){
		// console.log($(this).children());return false;
		$("input[name='jurisdiction[]']").prop("checked", $(this).children().prop("checked"));
	})
	$('.t2').click(function(){
		// console.log($(this).children());return false;
		$("input[name='jurisdiction1[]']").prop("checked", $(this).children().prop("checked"));
	})
	$('.t3').click(function(){
		// console.log($(this).children());return false;
		$("input[name='jurisdiction2[]']").prop("checked", $(this).children().prop("checked"));
	})
	$('.t4').click(function(){
		// console.log($(this).children());return false;
		$("input[name='jurisdiction3[]']").prop("checked", $(this).children().prop("checked"));
	})
	$('.t5').click(function(){
		// console.log($(this).children());return false;
		$("input[name='jurisdiction4[]']").prop("checked", $(this).children().prop("checked"));
	})
	$('.t6').click(function(){
		// console.log($(this).children());return false;
		$("input[name='jurisdiction5[]']").prop("checked", $(this).children().prop("checked"));
	})
	$('.t7').click(function(){
		// console.log($(this).children());return false;
		$("input[name='jurisdiction6[]']").prop("checked", $(this).children().prop("checked"));
	})

	$('#qr').click(function(){
		var checked=[];
		$('input:checkbox:checked').each(function(){
			var b=$(this).val() ;
			if(b == 'on'){

			}else{
				checked.push($(this).val());
			}
			
		})
		var id=$("input[name='id']").val();
		var role_name=$("input[name='role_name']").val();
		var func=$("input[name='func']").val();
		var status=$("#sex").val();
		// console.log(checked);return false;
        $.ajax({
            url:"{:U('Mechanism/role_add')}",
            data:{checked:checked,id:id,role_name:role_name,func:func,status:status},
            dataType:'json',
            type:'post',
            success:function(data){
            	if(data.result==1){
            		alert('成功');
        		    var url = "{:U('Mechanism/role_manage')}";
            		location.href=url;
            	}else{
            		alert('失败');
            		var url = "{:U('Mechanism/role_manage')}";
            		location.href=url;
            	}
            }
        })
	})
</script>